import type { App } from 'vue'

// Element Plus已经在build/vite/index.ts中通过unplugin-auto-import/vite、unplugin-vue-components/vite、unplugin-vue-components/resolvers(ElementPlusResolver)，进行了按需导入，
// 所以不需要按照全部导入的方式进行安装，但需要全局引入一些组件，不然一些下拉项样式有问题
import { ElLoading, ElScrollbar, ElButton } from 'element-plus'

const plugins = [ElLoading]

const components = [ElScrollbar, ElButton]

export const setupElementPlus = (app: App<Element>) => {
  plugins.forEach((plugin) => {
    app.use(plugin)
  })

  components.forEach((component) => {
    app.component(component.name, component)
  })
}
